import time
from public.action import *
from public.business import *
from public.testData import *
from public.tools import*

testCase="DBshop002_余额支付流程"
firefox=openBrowser(url)
DBshopLogin(firefox,userName,password)
#在首页的搜索框输入小米
firefox.find_element_by_xpath('//input[@name="keywords"]').send_keys('小米')
#点击搜索按钮
firefox.find_element_by_xpath('//input[@type="submit"]').click()

firefox.find_element_by_xpath("//a[@href='/dbshop/goods/8/2']").click()
switchWindow(firefox,2)
firefox.find_element_by_id('add_cart_submit').click()
time.sleep(2)
#点击去购物车结算按钮
firefox.find_element_by_link_text('去购物车结算').click()
# 3.点击"去结算"按钮
firefox.find_element_by_link_text('去结算').click()

firefox.find_element_by_xpath("//input[@value='下一步']").click()
firefox.find_element_by_xpath("//input[@value='yezf']").click()
firefox.find_element_by_xpath("//input[@value='确认订单']").click()
orderId=firefox.find_element_by_xpath("(//font[@color='color:#ED145B'])[2]").text
firefox.find_element_by_xpath("//input[@value='马上去支付']").click()
firefox.quit()

firefox=firefox=openBrowser(urlAdmin)
DBshopLoginAdmin(firefox)
DBshopEnterMenu2(firefox,"销售管理","订单管理")
firefox.find_element_by_name('order_sn').send_keys(orderId)
firefox.find_element_by_xpath('//button').click()#点击搜索按钮
firefox.find_element_by_link_text('编辑查看').click()
firefox.find_element_by_link_text('发货操作').click()
firefox.find_element_by_id("express_number").send_keys("1314520")
firefox.find_element_by_id("state_info").send_keys("假一赔三")
firefox.find_element_by_xpath('//button').click()

firefox.get(url)
